import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

import '../../../websocket_controller.dart';

class HistoryController extends GetxController {
 
  late WebsocketController websocketController;
  @override
  void onInit() {
    super.onInit();
    websocketController = Get.find<WebsocketController>();
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {
    super.onClose();
    websocketController.historyClients.clear();
    websocketController.historyPage = 1;
  }

  getHistoryClients() {
    websocketController.getHistoryClients();
  }

  onRefresh() {
    print("onRefresh");
    // websocketController.historyClients.clear();
    // websocketController.getHistoryClients(() {
      // refreshController.refreshCompleted();
    // });
  }

  onLoading() {
    print("onLoading");
    // if failed,use loadFailed(),if no data return,use LoadNodata()
    // 请求数据
    // refreshController.loadComplete();
  }
}
